#-*- coding:utf-8 -*-
'''
@date:2013年10月2日
@author: JeffXun
'''

import time

def StrToTime(nstr):
    """ nstr = '2013-01-07 12:00:24' """
    stime = time.strptime(nstr,"%Y-%m-%d %H:%M:%S")
    return time.mktime(stime)
    
  
#print int(strpTime('2013-01-07 12:18:12')) - 1366616465

def TimeToStr(mimseconds):
    """ mimseconds 自某年到xx的毫秒数"""
    stime = time.localtime(mimseconds);
    return time.strftime("%Y-%m-%d %H:%M:%S",stime);

def getCurrentTime():
    """ """
    stime = time.localtime();
    return stime

def getDayTime(day):
    """
    day =0 为当前时间
    day <0 表示过去多少天的现在时刻时间
    day > 0 表示将来 
    """
    mis = day * 24*3600
    stime = time.time() + mis;
    return stime
    
#getDayTime(-1) 昨天现在的时间